package lc.数组;

import java.util.HashSet;
import java.util.Set;

/**
 * @description:
 * @author: qian
 * @createDate: 2021/10/15
 */
public class 剑指Offer03_数组中重复的数字 {

    public int findRepeatNumber(int[] nums) {

        Set<Integer> set = new HashSet<>();
        for (int num : nums) {

            if (set.contains(num))
                return num;
            else
                set.add(num);
        }
        return 0;
    }
}
